package 类和对象;

public class Zuoye03211 {
    String name;
    int[] caipan = new int[7];

    public void chengji(int num) {
        for (int i = 0; i < caipan.length; i++) {
            if (caipan[i] == 0) {
                caipan[i] = num;
                break;
            }
        }
    }

    public void pingjunfen() {
        int dum=0;
        double lanmao=0;
        for (int i = 0; i < caipan.length - 1; i++) {
            for (int c = 0; c < caipan.length - 1 - i; c++) {
                if (caipan[c] > caipan[c + 1]) {
                    dum = caipan[c];
                    caipan[c] = caipan[c + 1];
                    caipan[c + 1] = dum;
                }
            }
        }
        for (int i = 1; i < caipan.length - 1; i++){
            lanmao+=caipan[i];
        }
        System.out.println(name+"的平均成绩为"+(lanmao/5)+"分");
    }


}
